const host = "47.103.218.109";
// const host = "localhost";
const port = "8997";
const wsUrl = `ws://${host}:${port}`;

/**
 * 消息体
 * @imType -3 首次登陆反馈 -2在线用户名单 -1 首次登陆 0 系统消息 1 用户消息 2 交易
 */
class WsDTO {
  constructor(username: string, body: any, imType = 0, targetId = 0) {
    this.username = username;
    this.imType = imType;
    this.targetId = targetId;
    this.body = body;
  }
  username: string; // 用户名称
  imType: number; // 消息类型
  targetId: number; // 目标id 0 为全部
  body: any; // 消息体
  ObjectToString() {
    return JSON.stringify(this);
  }
}

export { wsUrl, WsDTO };
